<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich">
	<body>

		<ui:composition template="/template/template.xhtml">
		
		  <ui:define name="title">Consultar Equipamentos</ui:define>
		  
		  <ui:define name="body">	
		  
		    <h:form id="form">
				<h:panelGrid styleClass="panelGrid">
					<h:panelGrid columns="3">
						<h:panelGrid columns="1">
							<h:outputLabel value="Serial:" for="serial" />
							<h:inputText id="serial" name="serial" value="#{crudEquipameno.equipamentoTO.serial}" />
						</h:panelGrid>
					</h:panelGrid>					
					<h:panelGrid columns="2">
						<h:commandButton value="incluir" action="#{crudEquipameno.goIncluir}" styleClass="button"/>
						<h:commandButton value="consultar" action="#{crudEquipameno.consultar}" styleClass="button"/>
					</h:panelGrid>

					
					<h:dataTable rendered="#{crudEquipameno.exibirTabela}" value="#{crudEquipameno.equipamentos}" var="item" styleClass="tabela" width="100%" rowClasses="even, odd">
						<h:column>
							<f:facet name="header">
								<h:outputText value="Serial" />
							</f:facet>
							<h:outputText value="#{item.serial}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Versao" />
							</f:facet>
							<h:outputText value="#{item.versaoTO.versao}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Status" />
							</f:facet>
							<h:outputText value="#{item.status}"></h:outputText>
						</h:column>						
						<h:column>
							<f:facet name="header">
								<h:outputText value="Acao" />
							</f:facet>
							<h:commandLink value="editar"
								actionListener="#{crudEquipameno.goEditar}">
								<f:param name="id" id="id" value="#{item.id}"></f:param>
							</h:commandLink>
							<br/>
							<h:commandLink value="remover"
								actionListener="#{crudEquipameno.remover}">
								<f:param name="id" id="id" value="#{item.id}"></f:param>
							</h:commandLink>
						</h:column>						
					</h:dataTable>
				</h:panelGrid>
		    </h:form>
		  </ui:define>
		
		</ui:composition>

	</body>
</html>